package com.zzz.demo.monitor.jmxx;

import com.zzz.demo.monitor.info.SystemInfo;

import javax.management.MBeanServer;
import javax.management.ObjectName;
import java.lang.management.ManagementFactory;

/**
 * 通过 jmx 上报运行信息测试
 */
public class JmxMain {

    public static void main(String[] args) throws Exception {
        MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
        ObjectName objectName = new ObjectName("com.zzz.demo:type=SystemInfo");
        mBeanServer.registerMBean(new SystemInfo(), objectName);
        System.in.read();
    }
}
